//------------------------------------------------------------------------
// Abstract: Define of class Timer
//
// Authoring: XiaoHanxiong
//
// Time: 2014.03.02
//
// Static test:
//
// Version history:
//		Ver_1.0 : 2014.03.02	XiaoHanxiong
//------------------------------------------------------------------------
#ifndef _Library_Timer_h_
#define _Library_Timer_h_

#include "stdafx.h"

namespace Library
{
	class _LIBRARY Timer
	{
	public:
		Timer(bool start_flag = false);
		virtual ~Timer();

	public:
		// Start timer
		void Start();
		// Reset timer
		void Reset();
		// Pause timer
		void Pause();
		// Resume timer
		void Resume();
		// If the timer paused
		bool IsPaused();
		// If the timer start
		bool IsStart();
		// Return the elapsed time
		double Elapsed();
		// Return the elapsed time in second(s)
		double ElapsedSec();
		// Return the max-capacity of timer
		double RemainSec();

	protected:
		// Init data member of timer
		void InitTimer(bool start_flag);
		// Obtain the time(dependent on specified system)
		clock_t GetClock();

	protected:
		clock_t m_startTime;
		clock_t m_elapsedTime;
		bool m_bPause;
		bool m_startFlag;

	public:
		// Return the timer count
		static unsigned int TimerCount();

	protected:
		static unsigned int m_timerNum;
	};

}// _Library_

#endif